var html5_audiotypes={ 
	"mp3": "audio/mpeg",
	"mp4": "audio/mp4",
	"ogg": "audio/ogg",
	"wav": "audio/wav"
}

function createsoundbite(sound){
	var html5audio=document.createElement('audio')
	if (html5audio.canPlayType){ //check support for HTML5 audio
		for (var i=0; i<arguments.length; i++){
			var sourceel=document.createElement('source')
			sourceel.setAttribute('src', arguments[i])
			if (arguments[i].match(/\.(\w+)$/i))
				sourceel.setAttribute('type', html5_audiotypes[RegExp.$1])
			html5audio.appendChild(sourceel)
		}
		html5audio.load()
		html5audio.playclip=function(){
			if( _settings.get("sound_on")==true ) {
				try {
					html5audio.pause();
					html5audio.currentTime=0;
					html5audio.play();
				} catch( err ) {
					// ignore
				}
			}
		}
		return html5audio;
	}
	else{
		return {playclip:function(){throw new Error("Your browser doesn't support HTML5 audio unfortunately")}}
	}
}

ArcoSounds = {
	Damage : createsoundbite("sound/damageO.mp3", "sound/damageO.ogg", "sound/damageO.wav"),
	Deal : createsoundbite("sound/dealO.mp3", "sound/dealO.ogg", "sound/dealO.wav"),
	ResourceUp : createsoundbite("sound/ress_upO.mp3", "sound/ress_upO.ogg", "sound/ress_upO.wav"),
	ProductionUp : createsoundbite("sound/resb_upO.mp3", "sound/resb_upO.ogg", "sound/resb_upO.wav"),
	ResourceDown : createsoundbite("sound/ress_downO.mp3", "sound/ress_downO.ogg", "sound/ress_downO.wav"),
	ProductionDown : createsoundbite("sound/resb_downO.mp3", "sound/resb_downO.ogg", "sound/resb_downO.wav"),
	Shuffle : createsoundbite("sound/shuffleO.mp3", "sound/shuffle.ogg", "sound/shuffle.wav"),
	TowerUp : createsoundbite("sound/tower_upO.mp3", "sound/tower_upO.ogg", "sound/tower_upO.wav"),
	WallUp : createsoundbite("sound/wall_upO.mp3", "sound/wall_upO.ogg", "sound/wall_upO.wav")
};